/**
 * 表单验证
 * 
 * @param {Object} rules 验证字段的规则
 * @param {Object} messages 验证字段的提示信息
 * 
 */

import basic from './basic.js';

var actmodel = new basic();


actmodel.offset = function (that, reset, para, xcsorts) { 
  if(!xcsorts)
  {
    xcsorts=[["id", "desc"], ["modifytime", "desc"]] ;
  }
 
  var acturlpara = {};   
  acturlpara["url"] = "entry/wxapp/activity_list"
  if (para) {
    para["op"] = "offset"
  }
  else {
    this.wherepara["op"] = "offset"
  }
  return actmodel.pagelist(acturlpara, that, reset, para, xcsorts);
}
actmodel.getmodel=function(id){
  var app = getApp();
  var data = { "op": "getmodel", id: id}
  return new Promise((resolve, reject) => {
    app.util.request({
      'url': 'entry/wxapp/activity_list',
      'data': data,
      'method': "post",
      success: function (res) {        
        resolve(res.data.data);
      }
    })
})
}
//全部活动数据
actmodel.getall=function(itype){
  var app = getApp();
  var data = { "op": "getall",itype}
  return new Promise((resolve, reject) => {
    app.util.request({
      'url': 'entry/wxapp/activity_list',
      'data': data,
      'method': "post",
      success: function (res) {        
        resolve(res.data.data);
      }
    })
})
}

module.exports = actmodel;